﻿package config {

import flash.utils.ByteArray;

public class BocreaData
{
    public var rlegColor :uint = 0x999999;
    public var llegColor :uint = 0xAAAAAA;
    public var learColor :uint = 0xAAAAAA;
	public var rearColor :uint = 0xAAAAAA;
    public var bodyColor :uint = 0xBBBBBB;
    public var larmColor :uint = 0xCCCCCC;
	public var rarmColor :uint = 0xAAAAAA;
    public var mouthColor :uint = 0x999999;
    public var headColor :uint = 0xCCCCCC;
	public var hatColor :uint = 0x0000FF;
	
    public var hatNumber :int = 2;
//	public var beardNumber :int = 2;

    public function clone () :BocreaData
    {
        var theClone :BocreaData = new BocreaData();
        theClone.fromMemory(toMemory());
        return theClone;
    }

    public function toMemory () :Object
    {
        return {
            rlegColor: rlegColor,
			llegColor: llegColor,
            learColor: learColor,
			rearColor: rearColor,
			bodyColor: bodyColor,
            larmColor: larmColor,
			rarmColor: rarmColor,
			mouthColor: mouthColor,
            headColor: headColor,
			hatColor: hatColor,
			hatNumber: hatNumber

        };
    }

    public function fromMemory (memory :Object) :void
    {
        if (memory == null) {
            return;
        }

        if ("rlegColor" in memory) {
            rlegColor = memory["rlegColor"];
        }
        if ("llegColor" in memory) {
            llegColor = memory["llegColor"];
        }
		if ("learColor" in memory) {
            learColor = memory["learColor"];
        }
		if ("rearColor" in memory) {
            rearColor = memory["rearColor"];
        }
        if ("bodyColor" in memory) {
            bodyColor = memory["bodyColor"];
        }
		if ("larmColor" in memory) {
            larmColor = memory["larmColor"];
        }
		if ("rarmColor" in memory) {
            rarmColor = memory["rarmColor"];
        }
        if ("mouthColor" in memory) {
            mouthColor = memory["mouthColor"];
        }
		if ("headColor" in memory) {
            headColor = memory["headColor"];
        }
		if ("hatColor" in memory) {
            hatColor = memory["hatColor"];
        }
        if ("hatNumber" in memory) {
            hatNumber = memory["hatNumber"];
        }
//        if ("beardNumber" in memory) {
//            beardNumber = memory["beardNumber"];
//        }
    }
}

}
